<!--
 * @Author: yaojian66 1327629137@qq.com
 * @Date: 2022-07-05 16:58:18
 * @LastEditors: yaojian66 1327629137@qq.com
 * @LastEditTime: 2022-07-05 17:03:54
 * @FilePath: \geyao\第一百一十八题 数组去重.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数组去重</title>
</head>

<body>
  <!-- 为 Array 对象添加一个去除重复项的方法
示例1
输入：

[false, true, undefined, null, NaN, 0, 1, {}, {}, 'a', 'a', NaN]

输出：

[false, true, undefined, null, NaN, 0, 1, {}, {}, 'a'] -->
  <script>
    Array.prototype.uniq = function () {
      return Array.from(new Set(this))
    }
  </script>
</body>

</html>